﻿using System;
using System.IO;

namespace ThreeDContentPipeline
{
    public class ExternalReference
    {
        public ExternalReference(string file)
        {
            string directory = Path.GetDirectoryName(file);
            string name = Path.GetFileNameWithoutExtension(file);

            if (Path.IsPathRooted(file))
            {
                AssetName = name;
                OutputFile = name + ".asset";
            }
            else
            {
                AssetName = Path.Combine(directory, name);
                OutputFile = AssetName + ".asset";
            }

            File = file;
        }

        public string AssetName
        {
            get;
            private set;
        }

        public string File
        {
            get;
            private set;
        }

        public string OutputFile
        {
            get;
            private set;
        }

        public string ToURL()
        {
            return AssetName.Replace("\\", "/");
        }
    }
}
